﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "INotifyService" in both code and config file together.
[ServiceContract]
public interface INotifyService
{
    [OperationContract]
    int CountNewMessage(String userName);

    [OperationContract]
    void CheckTimeOut();

    [OperationContract]
    List<Message> GetAllMessage(String UserName);
}
[DataContract]
public class User
{
    Guid userID;
    [DataMember]
    public Guid UserID
    {
        get { return userID; }
        set { userID = value; }
    }

    String userName;
    [DataMember]
    public String UserName
    {
        get { return userName; }
        set { userName = value; }
    }

    public User(User_Table ut)
    {
        userID = ut.UserID;
        userName = ut.Username;
    }

    public User()
    {
        
    }
}

[DataContract]
public class Message : User
{
    Guid messageID;
    [DataMember]
    public Guid MessageID
    {
        get { return messageID; }
        set { messageID = value; }
    }

    User userReciver;
    [DataMember]
    public User UserReciver
    {
        get { return userReciver; }
        set { userReciver = value; }
    }
    String messageContent;
    [DataMember]
    public String MessageContent
    {
        get { return messageContent; }
        set { messageContent = value; }
    }
    DateTime sendDate;
    [DataMember]
    public DateTime SendDate
    {
        get { return sendDate; }
        set { sendDate = value; }
    }

    public Message(Community_Table ct)
    {
        UserID = ct.User_Table.UserID;
        UserName = ct.User_Table.Username;
        messageID = ct.Mess_ID;
        userReciver = new User(ct.User_Table1);
        messageContent = ct.Mess_Content;
        sendDate = ct.Mess_Time;
    }
}

